package com.SuanFa.test;

import java.util.Scanner;

public class test6 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = 0, y = 0, z = 0;
        x = sc.nextInt();
        y = sc.nextInt();
        z = sc.nextInt();
        int totalnum = x * y * z;
        int q = sc.nextInt();
        int thrownum = 0;
        for (int i = 0; i < q; i++) {
            int[][] nums1 = new int[2][3];
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 3; k++) {
                    nums1[j][k] = sc.nextInt();
                }
            }
            int n = nums1[1][0] - nums1[0][0]+1;
            int m = nums1[1][1] - nums1[0][1]+1;
            int s = nums1[1][2] - nums1[0][2]+1;
            thrownum += n * m * s;
        }
        System.out.println(totalnum - thrownum);

    }
}
